package com.pet.server.ext.util;

import java.util.List;
import java.util.Map;
import org.json.JSONObject;

import com.pet.server.ext.Logger;
import com.tencent.xinge.ClickAction;
import com.tencent.xinge.Message;
import com.tencent.xinge.Style;
import com.tencent.xinge.TimeInterval;
import com.tencent.xinge.XingeApp;

public class XgPushHelper {
	public static final Logger logger = Logger.getLogger(XgPushHelper.class);
	public static final String SECRET_KEY="23a165b3eb4b699055d836c2c7cf5dfc";
	public static final long ACCESS_ID=2100173938;
	public static final String ACCESS_KEY="AX6DLLA3858S";
	public static void main(String[] args) {
		
	}
	public static void pushAccountList4Article(List<String> list,Map<String, Object> custom,String url,String title,String content){
		Message message = new Message();
		message.setType(Message.TYPE_NOTIFICATION);
		Style style = new Style(1);
		style = new Style(3,1,0,1,0);
		ClickAction action = new ClickAction(); 
		action.setActionType(ClickAction.TYPE_URL);
		action.setUrl(url);
		message.setTitle(title);
		message.setContent(content);
		message.setStyle(style);
		message.setAction(action);
		message.setCustom(custom);
		TimeInterval acceptTime1 = new TimeInterval(0,0,23,59);
		message.addAcceptTime(acceptTime1);
		XingeApp xinge = new XingeApp(ACCESS_ID, SECRET_KEY);
		JSONObject obj = xinge.pushAccountList(0, list, message);
		logger.logInfo(obj.toString());
	}
}
